package demo3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Microsoft
 * Date: 2022-11-29
 * Time: 11:53
 */
public class Computer {
    public void open() {
        System.out.println("开机");
    }
    public void close() {
        System.out.println("关机");
    }
    public void usbDevice(IUSB usb) {
        usb.openDevice();
        if(usb instanceof Mouse) {
            Mouse mouse = (Mouse) usb;
            mouse.click();
        }else if(usb instanceof KeyBoard) {
            KeyBoard keyBoard = (KeyBoard) usb;
            KeyBoard.inPut();
        }
        usb.closeDevice();
    }
}


